// component/details/imageList/imageList.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    goods_id: String
  },

  /**
   * 组件的初始数据
   */
  data: {
    details_title: ["拍卖详情", "推荐拍卖"],
    checked_show: 0,
  },
  attached() {
    setTimeout(() => {
      this.detailsData(this.data.checked_show)
    }, 0);
  },
  methods: {
    showTab(e) {
      this.setData({
        checked_show: e.currentTarget.dataset.index
      })
      this.detailsData(e.currentTarget.dataset.index)
    },
    detailsData(e) {
      var _this = this
      getApp().request({
        url: getApp().api.auction.bottom,
        method: "GET",
        data: {
          auction_id: _this.data.goods_id,
          status: e
        },
        success(res) {
          if (_this.data.checked_show == 0) {
            _this.setData({
              attr_list: res.data.attr_list
            })
          } else {
            _this.setData({
              auction_list: res.data.auction_list
            })
          }

          console.log(res.data.attr_list)
        },
        fail(res) {
          console.log(res)
        }
      })
    }
  }
})